
package util;

import java.util.EventObject;



public class DAOEvent extends EventObject{
    
    
    
    protected int id;
    protected int index;
    protected String field;
    public static final int DAO_CREATE      = 1;
    public static final int DAO_EXISTE      = 2;
    public static final int DAO_NOCREATE    = 3;
    public static final int DAO_ERROFIELD   = 4;
    public static final int DAO_RELOAD      = 5;
    public static final int DAO_REFRESH     = 6;
    public static final int DAO_DELETE      = 7;
    public static final int DAO_EDIT        = 8;
    public static final int DAO_UPDATE      = 9;
    public static final int DAO_NULL        = 10;
    public static final int DAO_FIRST       = 11;
    
    public DAOEvent(Object o, int id){
        super(o);
        this.id=id;
    }

    public DAOEvent(Object o, String s, int id){
        super(o);
        this.field = s;
        this.id=id;
    }
    
    public DAOEvent(Object o, int index, int id){
        super(o);
        this.id=id;
    }

    @Override
    public Object getSource(){
        return (source instanceof Object) ? (Object)source : null;
    }
    
    public Object[] getListSource(){
        return (source instanceof Object[]) ? (Object[])source : null;
    }

    public String getField(){
        return this.field;
    }

    public int getID(){
        return this.id;
    }

}
